package cool.taomu.box.kademlia.test

import cool.taomu.toolkit.service.centre.kademlia.utils.ResourceCollector
import java.util.HashSet
import java.util.Set
import org.junit.jupiter.api.Test

class ServiceCentreTest {

    @Test
    def void a() {
        var path = "GET:/stock/signal/5/sh.600000"
        var templates = #["GET:/stock/signal/{day}/{code}"].toSet
        var rc = new ResourceCollector();
        rc.scanResult = templates
        println(rc.matchesAnyTemplate(path))
    }

    @Test
    def void b() {
        val Set<String> scanResult = new HashSet()
        scanResult.add("bbb")
        scanResult.add("CCC")
        var Set<String> scanR = #["aaa", "bbb"].toSet
        scanR.forEach [ r |
            if (!scanResult.exists[it.equals(r)]) {
                scanResult.add(r)
            }
        ]
        println(scanResult)
    // LOG.info("添加扫描到 :{}", b)
    }
}
